package com.htgd.gardenexpo.dao;

import com.htgd.gardenexpo.entity.WxUserAchievement;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.htgd.gardenexpo.vo.MyAchievementItemVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 微信用户获得的成就 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2024-12-19
 */
public interface WxUserAchievementMapper extends BaseMapper<WxUserAchievement> {
    @Select("SELECT * FROM `wx_user_achievement` WHERE open_id =#{openId} AND achievement_id = #{id}")
    WxUserAchievement getByOpenIdAndAchievementId(@Param("openId") String openId, @Param("id")String id);

    List<MyAchievementItemVO> getByOpenIdAndCategory(@Param("openId") String openId, @Param("category") String category);
    List<MyAchievementItemVO> getMonthOpenId(@Param("openId") String openId,@Param("lastMonthStr") String lastMonthStr);
    List<MyAchievementItemVO> getQuarterByOpenId(@Param("openId")String openId,@Param("lastQuarterYear") int lastQuarterYear, @Param("lastQuarter")int lastQuarter);
    List<MyAchievementItemVO> getYearByOpenId(@Param("openId")String openId, @Param("lastYear")int lastYear);
}
